
const WINDOW_INFO = uni.getWindowInfo()
export const getStatusBarHeight = () => WINDOW_INFO.statusBarHeight || 0;

export const getTitleBarHeight = () => {
  const menuButtom = uni.getMenuButtonBoundingClientRect?.();
  if (menuButtom) {
    const { top, height } = menuButtom;
    return height + (top - getStatusBarHeight()) * 2
  } else {
    return 40
  }
}

export const getNavBarHeight = () => getStatusBarHeight() + getTitleBarHeight();

export const getLeftIcon = () => {
  let leftIconWidth = 0;
  // #ifdef MP-TOUTIAO
  const customButtom =
    tt?.getCustomButtomBoundingClientRect?.()
  const { leftIcon: { width, left } } = customButtom
  leftIconWidth = width + left * 2
  // #endif

  return leftIconWidth;
}
getLeftIcon()